<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:c="http://java.sun.com/jsp/jstl/core">
    <ui:composition> 
        <c:set var="item" value="#{sessionScope.extra1}"></c:set>
        <h:form>
        <p:panel header="#{item.name}" style="text-align:center;width:100%" >  
            <h:panelGrid columns="2" style="margin: auto">  
                <h:panelGrid columns="1" >  
                    <p:graphicImage value="#{item.picture}" height="290px" /> 
                    <h:panelGrid columns="3" style="text-align: center">  
                        <h:outputText value="En stock" style="font-size: 13px; color: green;font-weight:bold;" rendered="#{item.stock()}"/>
                        <h:outputText value="Reposición de 24 a 72h" style="font-size: 13px; color: red;font-weight:bold;" rendered="#{item.reposicion()}"/>
                        <h:panelGrid columns="3" style="margin-left: 60%">
                            <h:outputText value="#{item.price}" style="font-weight:bold;"/>  
                            <p:graphicImage value="recursos/images/za_euro.png" height="20px" /> 
                        </h:panelGrid>
                    </h:panelGrid>
                </h:panelGrid>
                <h:panelGrid columns="1" >  
                    <h:panelGrid columns="6" >  

                            <h:outputText value="Cantidad: " style="font-weight:bold;" /> 
                            <p:commandLink 
                                actionListener="#{purchaseManagedBean.decrement}" update="txt_count">
                                <p:graphicImage value="recursos/images/za_minus.png" height="20px" style="margin:0 10 0 10;" />
                            </p:commandLink>  
                            <h:outputText id="txt_count" value="#{purchaseManagedBean.quantity}" style="font-size: 16px" />        
                            <p:commandLink  
                                actionListener="#{purchaseManagedBean.increment}" update="txt_count">
                                <p:graphicImage value="recursos/images/za_plus.png" height="20px" style="margin:0 10 0 10;" />
                            </p:commandLink>  
                           
                            <h:outputText value="Nº Ref: #{item.idItem}" style="font-weight:bold;"/>
                          
                           
                            <c:if test="#{controllerBean.loged}">
                            <p:commandLink  ajax="false"
                                            actionListener="#{purchaseManagedBean.addCart(item)}" style="margin-left: 680%" >
                                <p:graphicImage value="recursos/images/za_addCart.png" height="50px"  />
                            </p:commandLink> 
                            </c:if>
                            <c:if test="#{!controllerBean.loged}">
                                <p:spacer width="50" height="10" />
                                <p:outputLabel value="Debe estar logeado"></p:outputLabel>
                            </c:if>
                       

                    </h:panelGrid>
                    <p:separator/> 
                    <h:inputTextarea readonly="true"  value="#{item.description}" style="min-width: 650px; min-height: 250px"/>  

                </h:panelGrid>
            </h:panelGrid>
        </p:panel>
        </h:form>

    </ui:composition>
</html>
